package com.luomo.java.juc.util;

import lombok.Getter;

/**
 * @author LiuMei
 * @date 2021-04-12.
 */
@Getter
public enum CountryEnum {

    ONE(1, "齐"),
    TWO(2, "楚"),
    THREE(3, "燕"),
    FOUR(4, "赵"),
    FIVE(5, "魏"),
    SIX(6, "韩"),
    ;

    private int code;
    private String name;

    CountryEnum(int i, String name) {
        this.code = i;
        this.name = name;
    }

    public static String getDescByCode(int code) {
        for (CountryEnum data : CountryEnum.values()) {
            if (data.getCode() == code) {
                return data.getName();
            }
        }
        return null;
    }
}
